<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript">
			jQuery(function() {
				jQuery('#permTree').tree({
					url : '<%=request.getContextPath() %>/perm/getPermList',
					parentField : 'pid',
					checkbox : true,
					formatter : function(node) {
						return node.name;
					},
					onLoadSuccess : function(node, data) {
						jQuery.post('<%=request.getContextPath() %>/role/getPermListByRole', {
							roleId : jQuery("#roleId").val()
						}, function(permList) {
							
								for (var i = 0; i < permList.length; i++) {
									var node = jQuery('#permTree').tree('find', permList[i]["id"]);
									
									if (node) {
										var isLeaf = jQuery('#permTree').tree('isLeaf', node.target);
										if (isLeaf) {
											jQuery('#permTree').tree('check', node.target);
										}
									}
								}
						}, 'json');
					}
				});
			});
			
		</script>
	</head>
	
	
	
	
	<div class="easyui-layout" data-options="fit:true,border:false">
		<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
			<form id="form" method="post" >
				<input type="hidden" name="id" value="${role.id}" id="roleId">
				<table class="formtab">
					<tr>
						<th width="15%">角色名称</th>
						<td width="30%">${role.name}</td>
						<th width="15%">上级角色</th>
						<td >${role.role.name}</td>
					</tr>
					<tr>
						<th>描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述</th>
						<td colspan="4">
							${role.description}
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<div style="overflow: auto;height:400px;">
								<ul id="permTree"></ul>
							</div>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
</html>
